using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_MastercustMap : EntityTypeConfiguration<so_Mastercust>
    {
        public so_MastercustMap()
        {
            // Primary Key
            this.HasKey(t => t.GroupNames);

            // Properties
            this.Property(t => t.ID)
                .HasMaxLength(6);

            this.Property(t => t.Customer)
                .HasMaxLength(110);

            this.Property(t => t.currency)
                .HasMaxLength(5);

            this.Property(t => t.SALESMAN)
                .HasMaxLength(30);

            this.Property(t => t.Address)
                .HasMaxLength(40);

            this.Property(t => t.phones)
                .HasMaxLength(30);

            this.Property(t => t.PAGER)
                .HasMaxLength(12);

            this.Property(t => t.CITY)
                .HasMaxLength(30);

            this.Property(t => t.POBOX)
                .HasMaxLength(12);

            this.Property(t => t.FAX)
                .HasMaxLength(19);

            this.Property(t => t.REGION)
                .HasMaxLength(5);

            this.Property(t => t.Store)
                .HasMaxLength(30);

            this.Property(t => t.GroupNames)
                .IsRequired()
                .HasMaxLength(31);

            // Table & Column Mappings
            this.ToTable("so_Mastercust");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Customer).HasColumnName("Customer");
            this.Property(t => t.NOTES).HasColumnName("NOTES");
            this.Property(t => t.currency).HasColumnName("currency");
            this.Property(t => t.SALESMAN).HasColumnName("SALESMAN");
            this.Property(t => t.Address).HasColumnName("Address");
            this.Property(t => t.phones).HasColumnName("phones");
            this.Property(t => t.PAGER).HasColumnName("PAGER");
            this.Property(t => t.CITY).HasColumnName("CITY");
            this.Property(t => t.POBOX).HasColumnName("POBOX");
            this.Property(t => t.FAX).HasColumnName("FAX");
            this.Property(t => t.REGION).HasColumnName("REGION");
            this.Property(t => t.Payment_TERMS).HasColumnName("Payment_TERMS");
            this.Property(t => t.Credit_hold).HasColumnName("Credit_hold");
            this.Property(t => t.Store).HasColumnName("Store");
            this.Property(t => t.date_added).HasColumnName("date_added");
            this.Property(t => t.BirthDate).HasColumnName("BirthDate");
            this.Property(t => t.master).HasColumnName("master");
            this.Property(t => t.GroupNames).HasColumnName("GroupNames");
        }
    }
}
